home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Networking & Communications / Serial NB Sample Driver / Task / inc / status.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  1.4 KB  |  68 lines  |  [TEXT/MPS ]

  1. /********************************************************************************/
  2. /*                                                                                */
  3. /*        status.c - status request processing.                                    */
  4. /*                                                                                */
  5. /*        Richard W. Mincher.  February 19, 1990.                                    */
  6. /*                                                                                */
  7. /*        Copyright © 1990 Apple Computer, Inc.  All rights reserved.                */
  8. /*                                                                                */
  9. /********************************************************************************/
  10.  
  11. #include    "AROSE.h"
  12. #include    "os.h"
  13. #include    "managers.h"
  14.  
  15. #include    "ARDriver.h"
  16. #include    "ARTask.h"
  17.  
  18. static unsigned short    csStuff[12];
  19. static unsigned short    csSize;
  20.  
  21. StatusCall()
  22. {
  23.     NetCopy( msg->mFrom, msg->mDataPtr, msg->mTo, csStuff, 24 );
  24.  
  25. #ifdef    DEBUG
  26.     printf("Status received.  mDataPtr = %x, mDataSize = %x, csCode=%x\n",
  27.         msg->mDataPtr, msg->mDataSize, csStuff[0] );
  28. #endif    DEBUG
  29.  
  30.     msg->mStatus = 0;
  31.     switch( csStuff[0] )
  32.     {
  33.         case    2:
  34.             csSize = 4;
  35.             CountInData();
  36.             break;
  37.         case    8:
  38.             csSize = 6;
  39.             GetStatus();
  40.             break;
  41.         default:
  42.             csSize = 0;
  43.             msg->mStatus = -18;    /* statusErr    */
  44.     }
  45.     NetCopy( msg->mTo, csStuff + 1, msg->mFrom, msg->mDataPtr + 2, csSize );
  46. }
  47.  
  48. CountInData()
  49. {
  50.     unsigned long    length;
  51.     
  52.     length = G->rxMax - G->rxCount;
  53.  
  54.     csStuff[1] = (length >> 16) & 0xFFFF;
  55.     csStuff[2] = length & 0xFFFF;
  56. }
  57.  
  58. GetStatus()
  59. {
  60.     csStuff[1] = (G->asyncErr << 8) | G->flowOff;
  61.     csStuff[2] = 0;
  62.     if (G->txQHead)
  63.         csStuff[2] = 0x100;
  64.     if (G->rxQHead)
  65.         csStuff[2] |= 1;
  66.     csStuff[3] = (G->CTSFlag << 8) | G->xOffFlag;
  67. }
  68.